﻿using System;

namespace LogikBug.Async.Tasks
{
	/// <summary>
	/// Provides an interface for object that monitor
	/// the execution life cycle of <see cref="Agent"/>s.
	/// </summary>
	public interface IAgentControllerEventHandler
	{
		/// <summary>
		/// The method that is called when a new <see cref="Agent"/> is started.
		/// </summary>
		void AgentStarted(AgentController controller, AgentContext context);

		/// <summary>
		/// The method that is called when an <see cref="Agent"/> has thrown an <see cref="Exception"/>.
		/// </summary>
		void AgentErrored(AgentController controller, AgentContext context, AgentResult result, Exception exception);

		/// <summary>
		/// The method that is called when an <see cref="Agent"/> is finished executing.
		/// </summary>
		void AgentCompleted(AgentController controller, AgentContext context, AgentResult result);

		/// <summary>
		/// The method that is called when an <see cref="Agent"/> is disposing of it's resources.
		/// </summary>
		void AgentDisposing(AgentController controller, AgentContext context, AgentResult result);
	}
}
